<template>
    <!--ASN明细-->
    <div id="AsnDetails">
        <v-details :detailData="data.detailData" :inputConfig="inputConfig" :rules="rules" @pop="setdata"></v-details>
    </div>
</template>

<script>

    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "AsnDetails",
        mixins: [baseMixin],
        props: {
            data: {
                type: Object
            }
        },
        data() {
            return {
                rules: {},
            }
        },
        computed: {
            inputConfig() {
                return [
                    [
                        {
                            type: "table",
                            label: this.$t('bill.customer'),
                            props: "cust_code",
                            tableConfig: [
                                {
                                    label: this.$t('bill.customer'),
                                    prop: "cust_code",
                                    input: "input",
                                },
                                {
                                    label: this.$t('bill.customerDesc'),
                                    prop: "cust_desc",
                                    input: "input",
                                }
                            ],
                            url: `/queryRpt/1/?/${this.$store.state.wms}`
                        },
                        {
                            type: "select",
                            label: this.$t('bill.wareHouse'),
                            props: "facility_id",
                            options: this.getOptions("getSelectCode/FACILITY_ID/NAME/BIC_FACILITY/1=1")
                        },
                        {
                            type: "table",
                            label: this.$t('bill.partnerGroup'),
                            props: "partner_group",
                            tableConfig: [
                                {
                                    label: this.$t('bill.partnerGroup'),
                                    prop: "partner_group",
                                    input: "input",
                                },
                                {
                                    label: this.$t('bill.partnerGroupDesc'),
                                    prop: "partner_group_desc",
                                    input: "input",
                                },
                            ],
                            url: `/queryPartnerGroupList/${this.$store.state.wms}/`
                        },
                    ],
                    [
                        {
                            type: "table",
                            label: this.$t('bill.carrierGroup'),
                            props: "carrier_group",
                            tableConfig: [
                                {
                                    label: this.$t('bill.carrierGroup'),
                                    prop: "carrier_group",
                                    input: "input",
                                },
                                {
                                    label: this.$t('bill.carrierGroupDesc'),
                                    prop: "carrier_group_desc",
                                    input: "input",
                                },
                            ],
                            url: `/queryCarrierGroupList/${this.$store.state.wms}/`
                        },
                        {
                            type: "table",
                            label: this.$t('bill.goodsGroup'),
                            props: "item_group",
                            tableConfig: [
                                {
                                    label: this.$t('bill.goodsGroup'),
                                    prop: "item_group",
                                    input: "input",
                                },
                                {
                                    label: this.$t('bill.goodsGroupDesc'),
                                    prop: "item_group_desc",
                                    input: "input",
                                },
                            ],
                            url: `/queryItemGroupList/${this.$store.state.wms}/`
                        },
                        {
                            type: "table",
                            label: this.$t('bill.locGroup'),
                            props: "loc_group",
                            tableConfig: [
                                {
                                    label: this.$t('bill.locGroup'),
                                    prop: "loc_group",
                                    input: "input",
                                },
                                {
                                    label: this.$t('bill.locGroupDesc'),
                                    prop: "loc_group_desc",
                                    input: "input",
                                },
                            ],
                            url: `/queryLocGroupListByFacility/${this.data.detailData.facility_id}/?/${this.$store.state.wms}`
                        },
                        {
                            type: "input",
                            label: this.$t('bill.transport'),
                            props: "trans_mode",
                        },
                    ]
                ]
            }
        },
        methods: {
            setdata(data, id, close, listId) {
                if (listId == '0' && id == "0") {
                    this.data.detailData.cust_code = data.cust_code;
                } else if (listId == "0" && id == "2") {
                    this.data.detailData.partner_group = data.partner_group;
                } else if (listId == "1" && id == "0") {
                    this.data.detailData.carrier_group = data.carrier_group;
                } else if (listId == "1" && id == "1") {
                    this.data.detailData.item_group = data.item_group;
                } else if (listId == "1" && id == "2") {
                    this.data.detailData.loc_group = data.loc_group;
                }
                close(false);
            }
        },
        mounted() {

        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
